<?php
	class Factories {

		private function __construct() {
		}

		private function __clone() {
		}

		public static function Init() {
			$obj = new Factories();

			return $obj;
		}

		public function databaseObject($quaryType, $tableName) {
			$name = ucfirst($quaryType) . ucfirst($tableName);
			try {
				$obj = new $name();

				return $obj;
			}
			catch (BadFunctionCallException $e) {
				echo " Problem : " . $e->getMessage() . " on line " . $e->getLine();
			}
		}

		public function controlerObject($name) {
			$name = ucfirst($name);
			try {
				$obj = new $name();

				return $obj;
			}
			catch (BadFunctionCallException $e) {
				echo " Problem : " . $e->getMessage() . " on line " . $e->getLine();
			}
		}

	}

?>